package com.gaozhaoyang.servlet;

import com.gaozhaoyang.entity.User;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
@WebServlet("/h2")
public class MyServlet_02 extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        ArrayList<User> list = new ArrayList<>();

        list.add(new User(1001, "小明", "跳舞"));
        list.add(new User(1002, "小华", "画画"));
        list.add(new User(1003, "小花", "跳绳"));
        req.setAttribute("list",list);
        req.getRequestDispatcher("/jsp/jsp_demo28.jsp").forward(req,resp);
    }
}